package com.yhhvip.user.dao;

import com.yhhvip.user.entity.Company;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

public interface CompanyDao extends JpaRepository<Company,Integer>,JpaSpecificationExecutor<Company>{

    //添加用户总余额
    @Transactional
    @Modifying
    @Query("update Company company set company.amount=company.amount-1 where company.companyId=?1")
    Integer updCompanyAmount(Integer companyId);

}
